﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace WeixinSB.Converter
{
    class DateToDateTimeOffset : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value is DateTime)
            {
                var dt = (DateTime)value;
                return new DateTimeOffset(dt);
            }

            return new DateTimeOffset(DateTime.Now);
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            if (value is DateTime)
            {
                var dt = (DateTime)value;
                return new DateTimeOffset(dt);
            }

            return new DateTimeOffset(DateTime.Now);
        }
    }
}
